import java.util.HashMap;
import java.util.Map;

public class IgoChessmanFactory {
    private Map<String, IgoChessman> chessmenMap = new HashMap<>();

    public IgoChessman getChessman(String color) {
        IgoChessman chessman = chessmenMap.get(color);
        if (chessman == null) {
            if ("Black".equals(color)) {
                chessman = BlackIgoChessman.getInstance();
            } else if ("White".equals(color)) {
                chessman = WhiteIgoChessman.getInstance();
            }
            chessmenMap.put(color, chessman);
        }
        return chessman;
    }
}